package org.xinjiang.data.migration.flush.enums;

import lombok.Getter;

/**
 * 源数据类型
 */
@Getter
public enum GzryCategoryEnum {

    派出所民警("9", "405", "其他警察", 43),
    司法所专职工作人员("1", "123", "司法所专职工作人员", 24),
    社工("2", "", "社会工作者", null),
    UNKNOWN("unknown", "未知", "未知", null);
    /**
     * 数据来源code
     */
    private String sourceCode;


    private String targetCode;

    private String targetName;

    private Integer targetId;

    public String toTargetIdString() {
        return String.valueOf(targetId.intValue());
    }

    GzryCategoryEnum(String sourceCode, String targetCode, String targetName, Integer targetId) {
        this.sourceCode = sourceCode;
        this.targetCode = targetCode;
        this.targetName = targetName;
        this.targetId = targetId;
    }

    public static GzryCategoryEnum toCode(String sourceCode) {
        for (GzryCategoryEnum value : GzryCategoryEnum.values()) {
            if (value.sourceCode.equals(sourceCode)) {
                return value;
            }
        }
        return UNKNOWN;
    }
}
